import React, { useState, useCallback } from 'react';

const Child = () => {
  console.log('1') // 持续打印

  const handlerClick = () => {
    console.log('child')
  }
  return (
    <div onClick = { handlerClick }> textInComponent </div>
  );
}

const App = () => {
  const [ count, setCount ] = useState(100)

  const addHandler = useCallback(() => {
    setCount((prevCount) => prevCount + 1)
  }, [])
  return (
    <div> 
      <button onClick = { addHandler }>add</button>{ count }
      <Child />
    </div>
  );

}
export default App
